package com.gsx.controller;

import com.gsx.bean.Good;
import com.gsx.service.GoodService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @Description TODO
 * @Authoe gsx
 * @Date 2021/04/06 下午 4:21
 **/
@Controller
@RequestMapping("/good")
public class GoodController {
    @Resource
    private GoodService goodService;

    @RequestMapping("/good")
    @ResponseBody
    public List<Good> getALLByBid(int bid){
        return goodService.getGoodAllByBid(bid);
    };
    @RequestMapping("/goodId")
    public String dispatcherGood(int gid, Model model ){
      model.addAttribute("good",goodService.getGoodById(gid));
        return "/html/info.jsp";
    };
}
